﻿using com.iot.core.infrastructure;
using Microsoft.EntityFrameworkCore;

namespace com.iot.core.data.entity
{
    public class MyDBStartup : INopDBStartup
    {
        
        public void OnModelCreating(ModelBuilder modelBuilder)
        {
          
            modelBuilder.Entity<HtDept>().Property(a => a.Lat).HasPrecision(14, 8);
            modelBuilder.Entity<HtDept>().Property(a => a.Lng).HasPrecision(14, 8);


            modelBuilder.Entity<HtRoleMenu>().HasIndex(a => a.HtroleId).HasDatabaseName("ix_htrolemenu_htroleid");

            modelBuilder.Entity<HtUserLogin>().HasIndex(a => new {a.Online,a.Token}).HasDatabaseName("ix_htuserlogin_isonline_token");
            modelBuilder.Entity<HtUserDept>().HasIndex(a => a.HtuserId).HasDatabaseName("ix_htuserdept_htuserid");
            modelBuilder.Entity<HtUserRole>().HasIndex(a => a.HtuserId).HasDatabaseName("ix_htuserrole_htuserid");

            modelBuilder.Entity<HtUserDept>().HasIndex(a => a.HtdeptId).HasDatabaseName("ix_htuserdept_htdeptId");

             
        }
        public int Order => 10;
    }
    
}
